package com.xian;

import java.util.Scanner;

/**
 * 需求:机票价格按照淡季旺季、头等舱和经济舱收费、输入机票原价、月份和头等舱或经济舱。
 * 按照如下规则计算机票价格:旺季(5-10月）头等舱9折，经济舱8.5折，淡季(11月到来年4月)头等舱7折，经济舱6 .5折。
 */
public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入机票原价:");
        double price = sc.nextDouble();

        System.out.println("请输入月份:");
        int month = sc.nextInt();

        System.out.println("请输入仓位类型(经济舱，头等舱):");
        String type = sc.next();

        double res=  cale(price,month,type);
        System.out.println(res);


    }

    public static double cale(double money, int month, String type) {
        if (month >= 5 && month <= 10) {
            switch (type) {
                case "经济舱":
                    money *= 0.85;
                    break;

                case "头等舱":
                    money *= 0.9;
                    break;

                default:
                    System.out.println("错误！！！");
                    money = -1;
            }
        } else if (month == 11 || month == 12 || month >= 1 && month <= 4) {
            switch (type) {
                case "经济舱":
                    money *= 0.65;
                    break;

                case "头等舱":
                    money *= 0.7;
                    break;

                default:
                    System.out.println("错误！！！");
                    money = -1;

            }
        } else {
            System.out.println("月份错误！！！");
            money = -1;
        }
        return money;
    }
}
